package com.ruyuan.dependency.product.service.impl;

import com.ruyuan.dependency.product.entity.Category;
import com.ruyuan.dependency.product.mapper.CategoryMapper;
import com.ruyuan.dependency.product.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author zhonghuashishan
 */
@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    private CategoryMapper categoryMapper;

    @Override
    public Category queryById(Long categoryId) {
        return categoryMapper.selectById(categoryId);
    }

    @Override
    public void save(Category category) {
        category.setCreateTime(new Date());
        category.setUpdateTime(category.getCreateTime());
        categoryMapper.insert(category);
    }
}